<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,user-scalable=no"/>
    <title>登录页</title>
    <link rel="stylesheet" href="../css/style.css">
    <script src="../src/jquery/jquery-3.3.1.min.js"></script>
    <script src="../src/jquery/layer-v3.1.1/layer/layer.js"></script>
    <script src="../src/global.js"></script>
    <script>
        var num = parseInt(location.search.substring(1));
        var tokk;
        if(localStorage.getItem('tok')){
            tokk=localStorage.getItem('tok');
            var phone=$('.phone').val();
            var code=$('.code').val();
            $.ajax({
                type: "POST",
                url: $host+'/api/open/login',
                data: {
                    phone:phone,
                    code:code
                },
                async: true,
                dataType:'json',
                success: function(result){
                    console.log(result);
                    if(result.status != 900000){
                        localStorage.clear();
                        switch (num) {
                            case 1:
                                window.location.href = 'dengluy.html?1';
                                break;
                            case 2:
                                window.location.href = 'dengluy.html?2';
                                break;
                            case 3:
                                window.location.href = 'dengluy.html?3';
                                break;
                            default:
                                break;
                        }
                    }
                },
                error:function(){
                    console.log('error')
                }
            })
            console.log(tokk);
            switch (num) {
                case 1:
                    window.location.href = "index.html?token="+tokk;
                    break;
                case 2:
                    window.location.href = "woyaohk.html?token="+tokk;
                    break;
                case 3:
                    window.location.href = "gerenzx.html?token="+tokk;
                    break;
                default:
                    break;
            }
        }
    </script>
</head>
<body class="dengluy">
    <!-- 返回 -->
    <div class="header">
        <!--<a href="index.html" class="l"><img src="../images/back_icon@2x.png" alt=""></a>-->
        <!--<p class="l dlymfh">返回</p>-->
    </div>

    <!-- content -->
    <div class="content">
        <div class="box btn_sjh">
            <img src="../images/input_icon01@2x.png" alt="" class="l"/>
            <input type="text" placeholder="手机号" class="l phone"/>
            <button class="r getcode" >获取验证码</button>
        </div>

        <div class="box btn_yzm">
            <img src="../images/input_icon02@2x.png" alt="" class="l"/>
            <input type="text" placeholder="验证码" class="l code"/>
        </div>

        <div class="box btn_dl">
            登 录
        </div>

    </div>


    <script src="../src/storage.js"></script>
    <script src="../src/cookie.js"></script>
    <script src="../src/js/gongzhong.js"></script>
    <script src="../src/js/dengluy.js"></script>
</body>
</html>